import xlrd
from xlutils.copy import copy
from name_list_print import list_check
#date = input()
def checkout(col_indexes):
    
    read_file = '/home/zyq/文档/P/docs/历史3月2.xls'
    wb = xlrd.open_workbook(read_file, formatting_info=True) #打开要修改的excel
    wb_c = copy(wb) #拷贝一份原来的excel
    sheet = wb_c.get_sheet(0) #获取第几个sheet页
    #col = wb_c2.col_values(1)
    global namelist
    namelist = list_check()
    #print(namelist)
    #global name
    #name = input("输入完成人的名字：")
    while True:
        global name
        name = input("输入完成人的名字：")
        try:
            row_indexes= namelist.index(name)
            break
        except ValueError:
            print("你输入的内容不在列表，列表内容如下")
            print(namelist)
           
        
     
    #print(indexes)

    col_indexes = int(col_indexes) + 2
    print(row_indexes)
    print(col_indexes)
    
    sheet.write(row_indexes, col_indexes ,'√')#行，列
    try:
        wb_c.save('/home/zyq/文档/P/docs/历史3月2.xls')
        print('记录成功。')
    except PermissionError:
        print("执行失败" )
        print('Do you close the test.xls?\n')



#checkout()



